package org.example.messenger.hibernate.dao;

import org.example.messenger.hibernate.domain.CustomerDBVO;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class CustomerDAO extends HibernateDaoSupport implements ICustomerDAO {

	@Override
	public Long createCustomer(CustomerDBVO newCustomer) {
		return (Long) getSession().save(newCustomer);
	}

	// TODO: DAO Interface Implementierung

	@Override
	public void deleteCustomer(CustomerDBVO customerDBVO) {
		getSession().delete(customerDBVO);
	}

	@Override
	public CustomerDBVO loadCustomer(Long id) {
		return (CustomerDBVO) getSession().load(CustomerDBVO.class, id);
	}

	@Override
	public CustomerDBVO readCustomer(Long id) {
		return (CustomerDBVO) getSession().get(CustomerDBVO.class, id);
	}

	@Override
	public void updateCustomer(CustomerDBVO customerDBVO) {
		createCustomer(customerDBVO);
	}

}
